﻿
#region NameSpace
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Eb.StockManagement;
using UserManage;
#endregion

public partial class BusinessProcessAutomation : System.Web.UI.Page
{
    #region Fields
    #endregion

    #region Methods
    #endregion

    #region Events


    [System.Web.Script.Services.ScriptMethod]
    [System.Web.Services.WebMethod]
    public static string[] GetEPSNItems()
    {
        System.Collections.Generic.List<string> items =
            new System.Collections.Generic.List<string>();

        
        return GetSyndicationItems();
    }
    [System.Web.Services.WebMethod]
    public static bool IsUserAvailable(string username)
    {
       
        UserManager _userRegister = new UserManager();
        string name = _userRegister.UserNameAvailabilityCheck(username);
        if (username == name)
            return false;
        else
            return true;
        MembershipUser usr = Membership.GetUser(username);
        return (usr == null);
    }


    /// <summary>
    /// 
    /// </summary>
    private static string[] GetSyndicationItems()
    {
        StockManagement stck = new StockManagement();
        //SELECT     ProductID, ProductName, ProductCode, ProductDescription, Stock, Type, ListPrice, Unit"+
        //  " FROM         ProductList
        DataSet ds = stck.GetProductDtls();
        System.Collections.Generic.List<string> items = new System.Collections.Generic.List<string>();
        // System.ServiceModel.Syndication.SyndicationFeed feed = 
        //  System.ServiceModel.Syndication.SyndicationFeed.Load(System.Xml.XmlReader.Create(feedUrl));

        // items.Add(string.Format("<span class='title'>{0}</span>", HttpUtility.HtmlEncode(feed.Title.Text)));
        items.Add(string.Format("<span class='MarqueeStock'>{0}</span>", HttpUtility.HtmlEncode("Our Product Details")));

        if (ds.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                items.Add(string.Format("<span  style=font-size:10;color:#0080C0>{0} <a href='{1}'>{2}</a><span >", "<b>Product Name", "ViewProductDetails.aspx?id=" + ds.Tables[0].Rows[i]["ProductID"].ToString(), HttpUtility.HtmlEncode(ds.Tables[0].Rows[i]["ProductName"].ToString() + ",\t\t" + "(Qty :" + ds.Tables[0].Rows[i]["Stock"].ToString() + ")")));

                if (items.Count > 5)
                {
                    break;
                }
            }
        }

        return items.ToArray();
    }                   
    protected void Page_Load(object sender, EventArgs e)
    {
    }

   

    #endregion
}
